from pathlib import PurePath
from typing import Any, Callable

from infection_monkey.exploit.tools import IRemoteAccessClientFactory
from infection_monkey.i_puppet import TargetHost

from .rdp_client import RDPClient
from .rdp_options import RDPOptions
from .rdp_remote_access_client import RDPRemoteAccessClient


class RDPRemoteAccessClientFactory(IRemoteAccessClientFactory):
    def __init__(
        self,
        host: TargetHost,
        options: RDPOptions,
        command_builder: Callable[[PurePath], str],
    ):
        self._host = host
        self._options = options
        self._command_builder = command_builder

    def create(self, **kwargs: Any) -> RDPRemoteAccessClient:
        return RDPRemoteAccessClient(self._host, self._options, self._command_builder, RDPClient())
